home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Batch / Solarize.ieb < prev    next >
Encoding:
Text File  |  1997-02-02  |  3.3 KB  |  136 lines

  1. /*
  2. ** $VER: Solarize.ieb 1.12, IE Arexx script
  3. ** Image Engineer Batch Processing script
  4. ** Copyright © by Patrik M Nydensten
  5. ** 2/2 1997 Stockholm/Sweden
  6. **
  7. ** Apply three types of solarize effects to image.
  8. */
  9.  
  10. options results
  11. signal on error
  12.  
  13. parse arg input command
  14. input = upper(strip(input))
  15. address 'IMAGEENGINEER'
  16.  
  17. select  /* Required batch script commands */
  18.   when input = 'INFO' then    return get_info()
  19.   when input = 'CONFIG' then  return get_config(command)
  20.   when input = 'PROCESS' then return process_image(command)
  21.   otherwise do
  22.     'REQUEST' '"Failure in call to batch script!"' '" Quit "'
  23.     return '<ERROR>'
  24.   end
  25. end
  26.  
  27. exit 0
  28.  
  29. /* Required "Get_info" procedure  ------------------------------------ */
  30. /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files       */
  31.  
  32. get_info:
  33.   back = 'OK'
  34. return back
  35.  
  36. /* Required "Get_config" procedure  ---------------------------------- */
  37.  
  38. get_config:
  39.   parse arg '"'command'"'
  40.  
  41.   'IE_TO_FRONT'
  42.  
  43.   if command = '' then do
  44.     'FORM "Solarize" " OK | Cancel "',
  45.     ' RADIO,"Type","Standard|Pg standard|Pg inverse",0'
  46.  
  47.     parse var result ok CalcType .
  48.     if ok = 0 then return '<ERROR>'
  49.   end
  50.   else do
  51.     'REQUEST' '"The Solarize.ieb does not have'd2c(10)'any settings for the last image."' '" OK "'
  52.     CalcType = 'none'
  53.   end
  54.  
  55.   back = '#'strip(CalcType)
  56. return back
  57.  
  58. /* Required "Process_image" procedure  ------------------------------- */
  59.  
  60. process_image:
  61.   parse arg '"'src_image'"' '"'dst_image'"' '"'options'"'
  62.   parse var options '#'CalcType .
  63.  
  64.   'OPEN' '"'src_image'"' '24'
  65.   if (RC ~= 0) then do
  66.     'IE_TO_FRONT'
  67.     'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "'
  68.     return '<ERROR>'
  69.   end
  70.   else LoadImage = result
  71.  
  72.   'NEGATIVE' LoadImage
  73.   NegImage=RESULT
  74.  
  75. select
  76.   when CalcType = 0 then do
  77.     'MARK' LoadImage 'PRIMARY'
  78.     'MARK' NegImage 'SECONDARY'
  79.     'COMPOSITE' 0 0 'MAX'
  80.     OutputImage = Result
  81.   end
  82.   when CalcType = 1 then do
  83.     'MARK' LoadImage 'SECONDARY'
  84.     'MARK' NegImage 'PRIMARY'
  85.     'COMPOSITE' 0 0 'DIFFERENCE'
  86.     DiffImage = Result
  87.  
  88.     'NEGATIVE' DiffImage
  89.     OutputImage = Result
  90.     'CLOSE' DiffImage
  91.   end
  92.   when CalcType = 2 then do
  93.     'MARK' LoadImage 'SECONDARY'
  94.     'MARK' NegImage 'PRIMARY'
  95.     'COMPOSITE' 0 0 'DIFFERENCE'
  96.     OutputImage = Result
  97.   end
  98.   otherwise return '<ERROR>'
  99. end /* select */
  100.  
  101.   'CLOSE' LoadImage
  102.   'CLOSE' NegImage
  103.  
  104.   if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1')
  105.   'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"'
  106.   if (RC ~= 0) then do
  107.     'IE_TO_FRONT'
  108.     'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "'
  109.     return '<ERROR>'
  110.   end
  111.   'CLOSE' OutputImage
  112.  
  113.   back = 'OK'
  114. return back
  115.  
  116. /* Internal procedures  ---------------------------------------------- */
  117.  
  118. /*******************************************************************/
  119. /* This is where control goes when an error code is returned by IE */
  120. /* It puts up a message saying what happened and on which line     */
  121. /*******************************************************************/
  122.  
  123. error:
  124. if RC=5 then do
  125.     IE_TO_FRONT
  126.     LAST_ERROR
  127.     'REQUEST "'||RESULT||'"'
  128. end
  129. else do
  130.     IE_TO_FRONT
  131.     LAST_ERROR
  132.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  133. end
  134.  
  135. return '<ERROR>'
  136.